﻿using Microsoft.AspNetCore.SignalR;
using Quantum.Core;

namespace Quantum.SignalR
{
    public abstract class AbstractReplier : Hub, IReplyBehavior
    {
        protected void Reply<T>(T outgoingMessage)
        {
            Clients.Client(Context.ConnectionId).InvokeAsync("Send", outgoingMessage);
        }

        public virtual void Send(string incomingMessage)
        {
            Reply(incomingMessage);
        }

        //public void SendObjects<TIn>(Outgoing<TIn> incomingMessage)
        //{
        //    Reply(new Incoming<string>
        //    {
        //        Code = 0,
        //        Messagae = "test",
        //        Payload = "test"
        //    });
        //}
    }
}
